<html>
<head><meta charset="utf-8"><title>How to report this bug? · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/How.20to.20report.20this.20bug.3F.html">How to report this bug?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="204376329"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/How%20to%20report%20this%20bug%3F/near/204376329" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aleš Katona <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/How.20to.20report.20this.20bug.3F.html#204376329">(Jul 19 2020 at 23:58)</a>:</h4>
<p>I have a rust-analyzer bug in my project where a <code>position()</code> method on a type is wrongly interpreted as belonging to <code>Iterator</code> causing RA to show a "expected 1 argument" error. The code is perfectly fine and compiles ok.</p>
<p>The method actually belongs to one of my types and has no arguments. RA seems to not be able to figure out the type due to how <a href="https://github.com/TomGillen/legion">Legion</a> returns values from their <code>::query()</code> call.</p>
<p>I'm unable to create a simple example at least on short notice because I'd have to get the whole legion setup going first (world etc.).</p>
<p>NOTE: this seems a regression I had this code in place for some time and it only started to show as error in RA in the last stable release.</p>



<a name="204389174"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/How%20to%20report%20this%20bug%3F/near/204389174" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/How.20to.20report.20this.20bug.3F.html#204389174">(Jul 20 2020 at 06:07)</a>:</h4>
<p>The error is new (the diagnostic didn't exist until recently), but it stems from resolving <code>position</code> to the wrong method. Your issue is probably similar to <a href="https://github.com/rust-analyzer/rust-analyzer/issues/5441">https://github.com/rust-analyzer/rust-analyzer/issues/5441</a>.</p>



<a name="204391477"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/How%20to%20report%20this%20bug%3F/near/204391477" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/How.20to.20report.20this.20bug.3F.html#204391477">(Jul 20 2020 at 06:57)</a>:</h4>
<p>Ah, I didn't notice the <code>use</code>.</p>



<a name="204436799"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/How%20to%20report%20this%20bug%3F/near/204436799" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aleš Katona <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/How.20to.20report.20this.20bug.3F.html#204436799">(Jul 20 2020 at 15:27)</a>:</h4>
<p><span class="user-mention silent" data-user-id="203546">Laurențiu Nicola</span> <a href="#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/How.20to.20report.20this.20bug.3F/near/204391477">said</a>:</p>
<blockquote>
<p>Ah, I didn't notice the <code>use</code>.</p>
</blockquote>
<p>I still have this issue without the <code>use</code> in a function in my larger code where I do not explicitly do <code>.deref()</code> but the code looks like:</p>
<div class="codehilite"><pre><span></span><code><span class="w">            </span><span class="k">if</span><span class="w"> </span><span class="kd">let</span><span class="w"> </span><span class="nb">Some</span><span class="p">((</span><span class="k">mut</span><span class="w"> </span><span class="n">pos</span><span class="p">,</span><span class="w"> </span><span class="k">mut</span><span class="w"> </span><span class="n">dim</span><span class="p">,</span><span class="w"> </span><span class="n">sub_sel</span><span class="p">))</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">query</span><span class="p">.</span><span class="n">iter</span><span class="p">(</span><span class="n">world</span><span class="p">).</span><span class="n">next</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">                  </span><span class="kd">let</span><span class="w"> </span><span class="n">edit_box</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">sub_sel</span><span class="p">.</span><span class="n">initial_pos</span><span class="p">.</span><span class="n">area</span><span class="p">(</span><span class="n">state</span><span class="p">.</span><span class="n">cursor</span><span class="p">);</span><span class="w"></span>
<span class="w">                  </span><span class="o">*</span><span class="n">pos</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="o">*</span><span class="n">edit_box</span><span class="p">.</span><span class="n">position</span><span class="p">();</span><span class="w"></span>
<span class="w">            </span><span class="p">}</span><span class="w"></span>
</code></pre></div>


<p>Where "edit_box" is a <code>&amp;Bounds</code> which has the <code>position()</code> method. I'll see if I can reproduce more directly in a standalone exmple.</p>



<a name="204438809"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/How%20to%20report%20this%20bug%3F/near/204438809" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aleš Katona <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/How.20to.20report.20this.20bug.3F.html#204438809">(Jul 20 2020 at 15:43)</a>:</h4>
<p><span class="user-mention silent" data-user-id="203546">Laurențiu Nicola</span> <a href="#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/How.20to.20report.20this.20bug.3F/near/204389174">said</a>:</p>
<blockquote>
<p>The error is new (the diagnostic didn't exist until recently), but it stems from resolving <code>position</code> to the wrong method. Your issue is probably similar to <a href="https://github.com/rust-analyzer/rust-analyzer/issues/5441">https://github.com/rust-analyzer/rust-analyzer/issues/5441</a>.</p>
</blockquote>
<p>Reported here without the local <code>use</code>  <a href="https://github.com/rust-analyzer/rust-analyzer/issues/5455">https://github.com/rust-analyzer/rust-analyzer/issues/5455</a></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>